3 Author: Andrés Mejía-Posada
4 (http://blogaritmo.factorcomun.org)
28 #define D(x) cout << #x " is " << x << endl
30 double pi
= acos(-1.0);
36 inline double distsqr(int x1
, int y1
, int x2
, int y2
){ return (x1
-x2
)*(x1
-x2
)+(y1
-y2
)*(y1
-y2
);}
38 bool colapse(crane
&a
, crane
&b
){
39 return (distsqr(a
.x
,a
.y
, b
.x
,b
.y
) <= (a
.r
+ b
.r
)*(a
.r
+ b
.r
) );
49 for (int i
=0; i
<n
; ++i
) cin
>> v
[i
].x
>> v
[i
].y
>> v
[i
].r
;
51 vector
<pair
<int, int> > bad
;
52 for (int i
=0; i
<n
; ++i
)
53 for (int j
=i
+1; j
<n
; ++j
)
54 if (colapse(v
[i
], v
[j
])){
55 bad
.push_back(make_pair(i
, j
));
56 //cout << "choque " << i << " " << j << endl;
61 for (int mask
=1; mask
< (1<<n
); ++mask
){
63 for (int i
=0; i
<bad
.size(); ++i
){
64 int &x
= bad
[i
].first
, &y
= bad
[i
].second
;
65 if ( (mask
& (1 << x
)) && (mask
& (1 << y
)) ){
74 for (int i
=0; i
<n
; ++i
){